<template>
	<view>
		<view class="admin">
			<view><uni-icons type="staff-filled" size="30"></uni-icons></view>
			<view>花卉农作物后台管理系统</view>
			<view @click="operate">
				<uni-icons type="contact-filled" size="30"></uni-icons>
			</view>
		</view>
		<view class="mainPage">
			<view class="naviBars">
				<view @click="tip">举报信息</view>
				<view @click="user">用户信息</view>
				<view @click="plant">植物信息</view>
				<view @click="message">留言信息</view>
				<view @click="posts">帖子信息</view>
				<view @click="grow">成长记录</view>
			</view>
			
			<view class="content">
				<view class="operate" v-if="operation==1">
					<view @click="Setting"><uni-icons type="gear-filled" size="18"></uni-icons>账户设置</view>
					<view @click="logout"><uni-icons type="close" size="18"></uni-icons>安全退出</view>
				</view>
				<view v-if="column==1">
					<view class="search">
						<uni-search-bar placeholder="请输入举报类型" bgColor="#EEEEEE" @input="tip_input" @confirm="search_tip"/>
					</view>
					<view class="tip_info_title">
						<view>类型</view>
						<view>举报人</view>
						<view>内容</view>
						<view>时间</view>
						<view>操作</view>
					</view>
					<view class="tip_info" v-for="tip in tip_info">
						<view>{{tip.tipType}}</view>
						<view>{{tip.tipUserId}}</view>
						<view>{{tip.tipCont}}</view>
						<view>{{tip.tipTime}}</view>
						<view @click="tip_details(tip.tipId)">详情</view>
					</view>
					<view>
						<uni-pagination @change="tip_pageChange"  :total="total" :pageSize="tip_pageSize" :current="page"></uni-pagination>
					</view>
					<uni-popup ref="popup" type="center" :mask-click="false">
						
						<view class="tip_popup">
							<view class="popup_title">
								<view class="item">举报信息处理</view>
								<view class="tip_time">
									{{'('+this.tip_detail.tipTime+')'}}
								</view>
							</view>
							
							<view class="tip_popup_info">
								<view class="detail">
									<view>举报用户：</view>
									<view>{{this.tip_detail.nickName}}</view>
								</view>
								<view class="detail">
									<view>被举报用户：</view>
									<view>{{this.tip_detail.nickNamed}}</view>
									<!-- <input type="text" v-model="this.user_detail.userSex"> -->
								</view>
								<view class="detail">
									<view>举报类型：</view>
									<view>{{this.tip_detail.tipType}}</view>
								</view>
								<view class="detail">
									<view>举报原因：</view>
									<view>{{this.tip_detail.tipReason}}</view>
								</view>
								<view class="detail">
									<view>举报内容：</view>
									<view>{{this.tip_detail.tipCont}}</view>
								</view>
								<view class="detail">
									<view>是否处理：</view>
									<view style="color: aqua;">{{this.tip_detail.isManage?'是':'否'}}</view>
								</view>
							</view>
							<view class="tip_popup_bottom">
								<button @click="tip_handle">处理</button>
								<button @click="close">取消</button>							
							</view>							
						</view>
					</uni-popup>
				</view>
				
				<view v-else-if="column==2">
					<view class="search">
						<uni-search-bar placeholder="请输入用户昵称" bgColor="#EEEEEE" @cancel="user_cancel" @input="user_input" @confirm="search_user"/>
					</view>
					<view class="user_info_title">
						<view>昵称</view>
						<view>邮箱</view>
						<view>性别</view>
						<view>操作</view>
					</view>
					<view class="user_info" v-for="user in user_info">
						<view>{{user.nickName}}</view>
						<view>{{user.useremail}}</view>
						<view>{{user.userSex?'女':'男'}}</view>
						<view @click="user_details(user)">详情</view>
					</view>
					<view>
						<uni-pagination @change="user_pageChange"  :total="total" :pageSize="pageSize" :current="page"></uni-pagination>
					</view>
					
					<uni-popup ref="popup" type="center" :mask-click="false">
						
						<view class="user_popup">
							<view class="popup_title">
								用户信息编辑
							</view>
							
							<view class="popup_info">
								<view class="detail">
									<view>用户姓名：</view>
									<view>{{this.user_detail.userName}}</view>
								</view>
								<view class="detail">
									<view>性别</view>
									<uni-data-checkbox v-model="this.user_detail.userSex" :localdata="sex"></uni-data-checkbox>
									<view >年龄：{{this.user_detail.userAge}}岁</view>
									<!-- <input type="text" v-model="this.user_detail.userSex"> -->
								</view>
								<view class="detail">
									<view>邮箱地址：</view>
									<view>{{this.user_detail.userEmail}}</view>
								</view>
								<view class="detail">
									<view>简洁：</view>
									<view>{{this.user_detail.description}}</view>
								</view>
								<view class="detail">
									<view>注册时间：</view>
									<view>{{this.user_detail.createTime}}</view>
								</view>
							</view>
							<view class="popup_bottom">
								<button @click="user_dele">删除</button>
								<button @click="reset">重置密码</button>
								<button @click="close">取消</button>							
							</view>							
						</view>
					</uni-popup>
					
				</view>
				
				<view v-else-if="column==3">
					<view class="search">
						<uni-search-bar placeholder="请输入植物名" bgColor="#EEEEEE" @input="plant_input" @cancel="plant_cancel" @confirm="search_plant" />
					</view>
					<view class="plant_info_title">
						<view>植物名</view>
						<view>别名</view>
						<view>相关信息</view>
						<view>操作</view>
					</view>
					<view class="plant_info" v-for="plant in plant_info">
						<view>{{plant.plantName}}</view>
						<view>{{plant.anotherName}}</view>
						<view>{{plant.plantContent}}</view>
						<view @click="plant_details(plant)">详情</view>
					</view>
	
					<view>
						<uni-pagination @change="plant_pageChange"  :total="total" :pageSize="pageSize" :current="page"></uni-pagination>
					</view>
					
					<uni-popup ref="popup" type="center" :mask-click="false">
						
						<view class="plant_popup">
							<view class="popup_title">
								植物信息编辑
							</view>
							
							<view class="popup_info">
								<view class="detail">
									<view>植物名称：</view>
									<view>{{this.plant_detail.plantName}}</view>
								</view>
								<view class="detail">
									<view>别名：</view>
									<!-- <uni-easyinput type="textarea" autoHeight v-model="value" placeholder="请输入内容"></uni-easyinput> -->
									<view>{{this.plant_detail.anotherName}}</view>
									<!-- <input type="text" v-model="this.plant_detail.otherName"> -->
								</view>
								<view class="detail">
									<view>发布时间：</view>
									<view>{{this.plant_detail.luchTime}}</view>
								</view>
								
								<view class="detail plantCont">
									<view>植物相关信息：</view>
									<uni-easyinput  :styles="styles" disabled type="textarea" v-model="this.plant_detail.plantContent" ></uni-easyinput>
								</view>
							</view>
							<view class="popup_bottom plantBottom">
								<button @click="plant_dele">删除</button>
								<button @click="close">取消</button>							
							</view>							
						</view>
					</uni-popup>
				</view>
				<view v-else-if="column==4">
					<view class="search">
						<uni-search-bar @input="msg_input" placeholder="请输入留言内容关键词" bgColor="#EEEEEE" @cancel="msg_cancel" @confirm="search_msg" />
					</view>
					<view class="plant_info_title">
						<view>发布用户</view>
						<view>留言内容</view>
						<view>发布时间</view>
						<view>操作</view>
					</view>
					<view class="plant_info" v-for="msg in msg_info">
						<view>{{msg.userId}}</view>
						<view>{{msg.msgCont}}</view>
						<view>{{msg.msgTime}}</view>
						<view @click="msg_details(msg.msgId)">详情</view>
					</view>
					
					<view>
						<uni-pagination @change="msg_pageChange"  :total="total" :pageSize="pageSize" :current="page"></uni-pagination>
					</view>
					
					<uni-popup ref="popup" type="center" :mask-click="false">
						<view class="user_popup">
							<view class="popup_title">
								留言信息管理
							</view>
							<view class="popup_info">
								<view class="detail msg">
									<view>发布的用户：</view>
									<view>{{this.msg_detail.msgUser}}</view>
								</view>
								<view class="detail msg">
									<view>发布时间：</view>
									<view>{{this.msg_detail.msgTime}}</view>
								</view>
								<view class="detail msg">
									<view>发布的内容：</view>
									<view>{{this.msg_detail.msgCont}}</view>
								</view>
							</view>
							<view class="popup_bottom msgBottom">
								<button @click="msg_dele">删除</button>
								<button @click="close">取消</button>							
							</view>							
						</view>
					</uni-popup>
				</view>
				
				<view v-else-if="column==6">
					<view class="search">
						<uni-search-bar @input="lunch_input" placeholder="请输入帖子标签或帖子内容关键词" @cancel="lunch_cancel" bgColor="#EEEEEE" @confirm="search_lunch" />
					</view>
					<view class="plant_info_title">
						<view>发布用户</view>
						<view>帖子标签</view>
						<view>帖子内容</view>
						<view>操作</view>
					</view>
					<view class="plant_info" v-for="lunch in lunch_info">
						<view>{{lunch.lunchId}}</view>
						<view>{{lunch.lunchLabel}}</view>
						<view>{{lunch.lunchCont}}</view>
						<view @click="lunch_details(lunch.lunchId)">详情</view>
					</view>
					
					<view>
						<uni-pagination @change="lunch_pageChange"  :total="total" :pageSize="pageSize" :current="page"></uni-pagination>
					</view>
					
					<uni-popup ref="popup" type="center" :mask-click="false">
						
						<view class="user_popup">
							<view class="popup_title">
								<view>帖子信息管理</view>
								<view class="lunch_time">{{this.lunch_detail.lunchTime}}</view>
							</view>
							
							<view class="popup_info">
								<view class="detail">
									<view>发布的用户：</view>
									<view>{{this.lunch_detail.nickName}}</view>
									<view class="isVi">
										<view>可见程度：</view>
										<view style="color: aqua;">{{this.lunch_detail.isVisible?'公开':'私有'}}</view>
									</view>
								</view>
								<view class="detail">
									<view>帖子标题：</view>
									<view>{{this.lunch_detail.lunchTitle}}</view>
								</view>
								
								<view class="detail">
									<view>帖子标签：</view>
									<view>{{this.lunch_detail.lunchLabel}}</view>
								</view>
								<view class="detail">
									<view>帖子内容：</view>
									<uni-easyinput  :styles="styles" disabled type="textarea" v-model="this.lunch_detail.lunchCont" ></uni-easyinput>
								</view>
								
							</view>
							<view class="popup_bottom lunchBottom">
								<button @click="lunch_dele">删除</button>
								<button @click="close">取消</button>							
							</view>							
						</view>
					</uni-popup>
				</view>
				
				<view v-else-if="column==7">
					<view class="search">
						<uni-search-bar placeholder="请输入植物名关键词" @input="grow_input" @cancel="grow_cancel" bgColor="#EEEEEE" @confirm="search_grow" />
					</view>
					<view class="plant_info_title">
						<view>用户名</view>
						<view>植物名</view>
						<view>记录内容</view>
						<view>开始时间</view>
						<view>操作</view>
					</view>
					<view class="grow_info" v-for="grow in grow_info">
						<view>{{grow.userid}}</view>
						<view>{{grow.recordPlantName}}</view>
						<view>{{grow.recordCont}}</view>
						<view>{{grow.recordTime}}</view>
						<view @click="grow_details(grow.userid)">详情</view>
					</view>
					
					<view>
						<uni-pagination @change="grow_pageChange"  :total="total" :pageSize="pageSize" :current="page"></uni-pagination>
					</view>
					<uni-popup ref="popup" type="center" :mask-click="false">
						<view class="user_popup">
							<view class="popup_title">
								<view>成长记录管理</view>
								<view class="lunch_time">{{this.grow_detail.recordTime}}</view>
							</view>
							
							<view class="popup_info">
								<view class="detail">
									<view>发布的用户：</view>
									<view>{{this.grow_detail.userId}}</view>
								</view>
								<view class="detail">
									<view>植物名称：</view>
									<view>{{this.grow_detail.recordPlantName}}</view>
								</view>
								
								<view class="detail">
									<view>记录内容：</view>
									<uni-easyinput  :styles="styles" disabled type="textarea" v-model="this.grow_detail.recordCont" ></uni-easyinput>
								</view>	
							</view>
							<view class="popup_bottom lunchBottom">
								<button @click="grow_dele">删除</button>
								<button @click="close">取消</button>							
							</view>							
						</view>
					</uni-popup>
				</view>
			</view>
		</view>
	</view>
	
</template>

<script>
import http from '../../utils/http';
	export default {
		data() {
			return {
				styles: {
					color: '#2979FF',
					borderColor: '#2979FF'
				},
				sex: [{
						text: '男',
						value: 0
					}, {
						text: '女',
						value: 1,
				}],
				plant_pop:0,
				user_pop:0,
				tip_name:'',
				plant_name:'',
				user_name:'',
				msg_name:'',
				lunch_name:'',
				grow_name:'',
				page:1,
				total:0,
				pageSize:10,
				tip_pageSize:8,
				operation:0,
				column:1,
				user_info:[],
				plant_info:[],
				tip_info:[],
				msg_info:[],
				lunch_info:[],
				grow_info:[],
				tip_detail:{
					isManage:'',
					nickName:'',
					nickNamed:'',
					tipCont:'',
					tipReason:'',
					tipTime:'',
					tipType:'',
					tipId:'',
				},
				user_detail:{
					userName:'',
					userEmail:'',
					userSex:'',
					userAge:'',
					createTime:'',
					description:'',
					avatar:'',
					userId:'',
					version:'',
				},
				plant_detail:{
					plantName:'',
					anotherName:'',
					plantContent:'',
					luchTime:'',
					plantId:'',
				},
				msg_detail:{
					msgUser:'',
					msgCont:'',
					msgTime:'',
					msgId:''
				},
				lunch_detail:{
					lunchId:'',
					lunchType:'',
					lunchTitle:'',
					lunchLabel:'',
					lunchCont:'',
					lunchTime:'',
					nickName:'',
					isVisible:''
				},
				grow_detail:{
					grid:'',
					recordCont:'',
					recordPlantName:'',
					recordTime:'',
					userid:''
				}				
			}
		},
		onLoad() {
			this.tip();
			this.operation = 0;
		},
		methods: {
			Setting(){
				this.operation = 0;
				uni.navigateTo({
					url: '../backend/setting',
				});
			},
			logout(){
				http({
					method:'post',
					url:`/admin/logout`,
					data:{
					},
					success: (res) => {
						// console.log(res.data)
						if(res.data.code == 1){
							uni.showToast({titile:'退出登录',icon:'success'})
							uni.navigateTo({
								url: '../backend/login'
							});
						}else{
							uni.showToast({titile:'退出失败',icon:'error'})
						}	
					},
					fail:(error)=>{
						// console.log(error)
						uni.showToast({titile:'出错了'.msg,icon:'error'})
					}
				})
				
			},
			close() {
				this.$refs.popup.close()
			},
			search_tip(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'search',
				}),
				this.tip_name = res.value;
				// console.log(this.user_name)
				this.tip();
			},
			tip_input(e){
				uni.showToast({
					title: '搜索：' + e,
					icon: 'search',
				})
				this.tip_name = e;
				this.page = 1;
				this.tip();	
			},
			user_input(e){
				// console.log(e)
				uni.showToast({
					title: '搜索：' + e,
					icon: 'search',
				})
				this.user_name = e;
				this.page = 1;
				this.user();
			},
			plant_input(e){
				// console.log(e)
				uni.showToast({
					title: '搜索：' + e,
					icon: 'search',
				})
				this.plant_name = e;
				this.page = 1;
				this.plant();
			},msg_input(e){
				// console.log(e)
				uni.showToast({
					title: '搜索：' + e,
					icon: 'search',
				})
				this.msg_name = e;
				this.page = 1;
				this.message();
			},
			lunch_input(e){
				// console.log(e)
				uni.showToast({
					title: '搜索：' + e,
					icon: 'search',
				})
				this.lunch_name = e;
				this.page = 1;
				this.posts();
			},
			grow_input(e){
				// console.log(e)
				uni.showToast({
					title: '搜索：' + e,
					icon: 'search',
				})
				this.grow_name = e;
				this.page = 1;
				this.grow();
			},
			search_user(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'search',
				}),
				this.user_name = res.value;
				this.page = 1;
				// console.log(this.user_name)
				this.user();
			},
			search_plant(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'search',
				}),
				this.plant_name = res.value;
				this.page = 1;
				// console.log(this.user_name)
				this.plant();
			},
			search_msg(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'search',
				}),
				this.msg_name = res.value;
				this.page = 1;
				// console.log(this.user_name)
				this.message();
			},
			search_lunch(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'search',
				}),
				this.lunch_name = res.value;
				this.page = 1;
				// console.log(this.user_name)
				this.posts();
			},
			search_grow(res) {
				uni.showToast({
					title: '搜索：' + res.value,
					icon: 'search',
				}),
				this.grow_name = res.value;
				this.page = 1;
				// console.log(this.user_name)
				this.grow();
			},
			operate(){
				if(this.operation == 1){
					this.operation=0;
				}else{
					this.operation=1;
				}
			},
			tip_pageChange(e){
				this.page=e.current;
				this.tip();
			},
			user_pageChange(e){
				this.page=e.current;
				this.user();
			},
			plant_pageChange(e){
				this.page=e.current;
				this.plant();
			},
			msg_pageChange(e){
				this.page=e.current;
				this.message();
			},
			lunch_pageChange(e){
				this.page=e.current;
				this.posts();
			},
			grow_pageChange(e){
				this.page=e.current;
				this.grow();
			},
			tip(){
				this.operation = 0;
				this.column=1;
				plant_name:'';
				user_name:'';
				msg_name:'';
				lunch_name:'';
				grow_name:'';
				http({
					url:'/tip/page',
					params:{
						name:this.tip_name,
						page:this.page,
						pageSize:this.pageSize,
					},
					success:(res)=>{
						// console.log(res.data.data.records)
						// console.log(res.data.data.length)
						this.total = res.data.data.total;
						this.tip_info = res.data.data.records;					
					}
				})
			},
			tip_details(tipId){
				// console.log(tipId)
				this.$refs.popup.open('center');
				http({
					url:'/tip/getTipPlusById',
					params:{
						id:tipId
					},
					success:(res)=>{
						// console.log(res.data.data)
						this.tip_detail.tipId = tipId;
						this.tip_detail.isManage = res.data.data.isManage;
						this.tip_detail.nickName = res.data.data.nickName;
						this.tip_detail.nickNamed = res.data.data.nickNamed;
						this.tip_detail.tipCont = res.data.data.tipCont;
						this.tip_detail.tipReason =res.data.data.tipReason;
						this.tip_detail.tipTime = res.data.data.tipTime;
						this.tip_detail.tipType = res.data.data.tipType;
						// console.log(this.total)
					}
				})
			},
			tip_handle(){
				uni.showModal({
					title:"提示",
					content:"确定处理该举报信息吗？",
					success:(res)=>{
						// console.log(res);
						if(res.confirm){
							// console.log(res);
								http({
									url:'/tip',
									method:'put',
									data:{
										tipId:this.tip_detail.tipId,
										isManage:1,
									},
									success:(res)=>{
										// console.log(res.data.code)
										if(res.data.code == 1){
											uni.showToast({titile:'已标记处理',icon:'success'})
											this.close();
										}else{
											uni.showToast({titile:'处理失败',icon:'error'})
										}
									}
								})
							this.tip();
						}
					},
				})
			},
			user(){
				this.operation = 0;
				this.column=2;
				tip_name:'';
				plant_name:'';
				msg_name:'';
				lunch_name:'';
				grow_name:'';
				http({
					url:'/user/page',
					params:{
						name:this.user_name,
						page:this.page,
						pageSize:this.pageSize,
					},
					success:(res)=>{
						// console.log(res.data.data.records)
						this.total = res.data.data.total;
						// console.log(this.total)
						this.user_info = res.data.data.records;				
					}
				})
			},
			user_dele(){
				uni.showModal({
					title:"提示",
					content:"确定删除该用户吗？",
					success:(res)=>{
						// console.log(res);
						if(res.confirm){
							// console.log(itemId);
							http({
								url:'/user',
								method:'delete',
								params:{
									id:this.user_detail.userId,
								},
								success:(res)=>{
									// console.log(res)
									uni.showToast({titile:'删除成功',icon:'success'})
									this.close();
								}
							})
							this.user();
						}
					},
				})
			},
			plant_dele(){
				// console.log(this.plant_detail.plantId)
				uni.showModal({
					title:"提示",
					content:"确定删除该植物吗？",
					success:(res)=>{
						// console.log(res);
						if(res.confirm){
							// console.log(itemId);
							http({
								url:'/plant',
								method:'delete',
								data:{
									plantId:this.plant_detail.plantId,
								},
								success:(res)=>{
									// console.log(res)
									uni.showToast({titile:'删除成功',icon:'success'})
									this.close();
								}
							})
							this.plant();
						}
					},
				})
			},
			msg_dele(){
				// console.log(this.msg_detail.msgId)
				uni.showModal({
					title:"提示",
					content:"确定删除该留言信息吗？",
					success:(res)=>{
						// console.log(res);
						if(res.confirm){
							// console.log(itemId);
							http({
							
								url:'/message',
								method:'delete',
								params:{
									id:this.msg_detail.msgId,
								},
								success:(res)=>{
									console.log(res)
									uni.showToast({titile:'删除成功',icon:'success'})
									this.close();
								}
							})
							this.message();
						}
					},
				})
			},
			reset(){
				// console.log(this.user_detail.userId)
				uni.showModal({
					title:"提示",
					content:"确定要重置该用户密码吗？",
					success:(res)=>{
						// console.log(res);
						if(res.confirm){
							// console.log(itemId);
							http({
								url:'/user',
								method:'PUT',
								data:{
									avatar:this.user_detail.avatar,
									userId:this.user_detail.userId,
									userPWD:'123456',
								},
								success:(res)=>{
									// console.log(res)
									uni.showToast({titile:'重置成功',icon:'success'})
									this.close();
								}
							})
							this.user();
						}
					},
				})
			},
			user_details(user){
				// console.log(user);
				this.$refs.popup.open('center');
				this.user_detail.userName = user.nickName;
				this.user_detail.userSex = user.userSex;
				this.user_detail.userEmail = user.useremail;
				// console.log(user.useremail)
				this.user_detail.userAge = user.userAge;
				this.user_detail.description = user.description;
				this.user_detail.createTime = user.createTime;
				this.user_detail.userId = user.userId;
				// this.user_detail.version = user.version;
				// console.log(this.user_detail.userId);
				this.user_detail.avatar = user.avatar;
				// console.log(this.user_detail.avatar);
			},
			plant(){
				this.operation = 0;
				this.column=3;
				tip_name:'';
				user_name:'';
				msg_name:'';
				lunch_name:'';
				grow_name:'';
				http({
					url:'/plant/page',
					params:{
						name:this.plant_name,
						page:this.page,
						pageSize:this.pageSize,
					},
					success:(res)=>{
						// console.log(res.data.data)
						this.total = res.data.data.total;
						this.plant_info = res.data.data.records;					
					}
				})
			},
			plant_details(plant){
				// console.log(plant);
				this.$refs.popup.open('center');
				this.plant_detail.plantName = plant.plantName;
				this.plant_detail.anotherName = plant.anotherName;
				this.plant_detail.plantContent = plant.plantContent;
				this.plant_detail.luchTime = plant.luchTime;
				this.plant_detail.plantId = plant.plantId;
				// console.log(plant.totancyCont);
			},
			message(){
				this.operation = 0;
				this.column=4;
				tip_name:'';
				plant_name:'';
				user_name:'';
				lunch_name:'';
				grow_name:'';
				http({
					url:'/message/page',
					params:{
						name:this.msg_name,
						page:this.page,
						pageSize:this.pageSize,
					},
					success:(res)=>{
						// console.log(res.data.data)
						this.total = res.data.data.total;
						this.msg_info = res.data.data.records;					
					}
				})
			},
			msg_details(msgId){
				// console.log(msgId)
				http({
					url:'/message/msgPlusByMsgId',
					params:{
						id:msgId
					},
					success:(res)=>{
						this.$refs.popup.open('center');
						// console.log(res.data)
						this.msg_detail.msgUser = res.data.data[0].nickName;
						this.msg_detail.msgCont = res.data.data[0].msgCont;
						this.msg_detail.msgTime = res.data.data[0].msgTime;
						this.msg_detail.msgId = res.data.data[0].msgId;
					}
				})
			},
			posts(){
				this.operation = 0;
				this.column=6;
				tip_name:'';
				plant_name:'';
				user_name:'';
				msg_name:'';
				grow_name:'';
				http({
					url:'/lunch/page',
					params:{
						name:this.lunch_name,
						page:this.page,
						pageSize:this.pageSize,
					},
					success:(res)=>{
						// console.log(res.data.data.records)
						this.total = res.data.data.total;
						this.lunch_info = res.data.data.records;					
					}
				})
			},
			lunch_details(lunchId){
				// console.log(lunchId)
				http({
					url:'/lunch/'+lunchId,
					params:{
						id:lunchId
					},
					success:(res)=>{
						// console.log(res.data.data)
						this.$refs.popup.open('center');
						// console.log(res.data.data[0])
						this.lunch_detail.nickName = res.data.data.nickName;
						this.lunch_detail.lunchType = res.data.data.lunchType;
						this.lunch_detail.lunchLabel = res.data.data.lunchLabel;
						this.lunch_detail.lunchTitle = res.data.data.lunchTitle;
						this.lunch_detail.lunchCont = res.data.data.lunchCont;
						this.lunch_detail.lunchTime = res.data.data.lunchTime;
						this.lunch_detail.isVisible = res.data.data.isVisible;
						this.lunch_detail.lunchId = res.data.data.lunchId;						
					}
				})
			},
			lunch_dele(){
				uni.showModal({
					title:"提示",
					content:"确定删除该帖子信息吗？",
					success:(res)=>{
						// console.log(res);
						if(res.confirm){
							// console.log(itemId);
							http({
								url:'/lunch/'+this.lunch_detail.lunchId,
								method:'delete',
								data:{
									ids:this.lunch_detail.lunchId,
								},
								success:(res)=>{
									// console.log(res.data)
									if(res.data.msg == '此数据关联其他数据，不能删除'){
										uni.showToast({titile:res.data.msg,icon:'error'})
									}else{
										uni.showToast({titile:'删除成功',icon:'success'})
									}
									
									this.close();
								}
							})
							this.posts();
						}
					},
				})
			},
			grow(){
				this.operation = 0;
				this.column=7;
				tip_name:'';
				plant_name:'';
				user_name:'';
				msg_name:'';
				lunch_name:'';
				http({
					url:'/growthrecord/page',
					params:{
						name:this.grow_name,
						page:this.page,
						pageSize:this.pageSize,
					},
					success:(res)=>{
						// console.log(res.data.data.records)
						this.total = res.data.data.total;
						this.grow_info = res.data.data.records;					
					}
				})
			},
			grow_details(userid){
				http({
					url:'/growthrecord/'+userid,
					params:{
						userId:userid
					},
					success:(res)=>{
						// console.log(res.data.data[0])
						this.$refs.popup.open('center');
						this.grow_detail.userId = res.data.data[0].userid;
						this.grow_detail.recordPlantName = res.data.data[0].recordPlantName;
						this.grow_detail.recordCont = res.data.data[0].recordCont;
						this.grow_detail.recordTime = res.data.data[0].recordTime;
						this.grow_detail.grid = res.data.data[0].grid;
					}
				})
			},
			grow_dele(){
				// console.log(this.grow_detail.grid)
				uni.showModal({
					title:"提示",
					content:"确定删除该成长记录信息吗？",
					success:(res)=>{
						// console.log(res);
						if(res.confirm){
							// console.log(itemId);
							http({
								url:'/growthrecord',
								method:'delete',
								data:[
									this.grow_detail.grid
								],
								success:(res)=>{
									if(res.data.code == 1){
										uni.showToast({titile:'删除成功',icon:'success'})
									}else{
										uni.showToast({titile:'删除失败',icon:'error'})
									}
									this.close();
								}
							})
							this.grow();
						}
					},
				})
			},
			user_cancel(res){
				uni.showToast({
					title: '点击取消，输入值为：' + res.value,
					icon: 'none'
				})
				this.user_name = '';
				this.user();
			},
			plant_cancel(res){
				uni.showToast({
					title: '点击取消，输入值为：' + res.value,
					icon: 'none'
				})
				this.plant_name = '';
				this.plant();
			},
			plant_cancel(res){
				uni.showToast({
					title: '点击取消，输入值为：' + res.value,
					icon: 'none'
				})
				this.plant_name = '';
				this.plant();
			},
			msg_cancel(res){
				uni.showToast({
					title: '点击取消，输入值为：' + res.value,
					icon: 'none'
				})
				this.msg_name = '';
				this.message();
			},
			msg_cancel(res){
				uni.showToast({
					title: '点击取消，输入值为：' + res.value,
					icon: 'none'
				})
				this.msg_name = '';
				this.message();
			},
			lunch_cancel(res){
				uni.showToast({
					title: '点击取消，输入值为：' + res.value,
					icon: 'none'
				})
				this.lunch_name = '';
				this.posts();
			},
			grow_cancel(res){
				uni.showToast({
					title: '点击取消，输入值为：' + res.value,
					icon: 'none'
				})
				this.grow_name = '';
				this.grow();
			}
		}
	}
</script>

<style>
.mainPage {
	display: flex;
	width: 750rpx;
	height: 1140rpx;
}
.admin {
	display:flex;
	justify-content: space-between;
	background-color: rgb(64, 158, 255);
	height: 80rpx;
}
.admin view {
	width: 120rpx;
	line-height: 80rpx;
	text-align: center;
	}
.admin view:nth-child(2){
	width: 370rpx;
	color: #fff;
}
.operate {
	width: 160rpx;
	color: rgb(96, 98, 102);
	position:absolute;
	top:0rpx;
	right: 0rpx;
	z-index: 1;
	border-radius: 10rpx;
	background-color: #fff;	
	text-align: center;
	box-shadow: 0 0 1px 1px #919191;
}
.operate view {
	font-size: 12px;
	height: 60rpx;
	line-height: 60rpx;
}
.operate view:hover {
	background-color: #e2e2e2;
}
.naviBars {
	padding-top: 50rpx;
	display: flex;
	flex-direction: column;
	background-color: rgb(0, 33, 64);
	width: 120rpx;
}
.naviBars view {
	align-items: center;
	height: 140rpx;
	text-align: center;
	line-height: 120rpx;
	font-family: "思源黑体旧字形 Light", 思源黑体旧字形;
	font-weight: 300;
	font-style: normal;
	font-size: 14px;
	color: rgba(255, 255, 255, 0.498);
}
.naviBars view:hover{
	background-color: rgb(102, 110, 232);
	color: #fff;
}
.content {
	position: relative;
	display: flex;
	flex: 1;
}
.search  {
	text-align: center;
	width: 630rpx;
}
.user_info_title{
	display: flex;
	justify-content: space-between;
}
.tip_info_title {
	display: flex;
	justify-content: space-between;
}
.user_info_title>view{
	width: 120rpx;
	color: #414141;
	font-size: 32rpx;
}
.user_info {
	display: flex;
	border: 1px solid #919191;
	justify-content: flex-start;
}
.tip_info {
	display: flex;
	border: 1px solid #919191;
	justify-content: flex-start;
}

.tip_info>view {
	color: #919191;
	font-size: 28rpx;
	line-height: 80rpx;
	width: 100rpx;
	height: 80rpx;
	display: -webkit-box;
	word-break: break-all;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	overflow: hidden;
	text-overflow: ellipsis;
}
.tip_info>view:nth-child(2) {
	margin-left: 40rpx;
}
.tip_info>view:nth-child(3) {
	margin-left: 30rpx;
}
.tip_info>view:nth-child(4) {
	margin-left: 30rpx;
}
.tip_info>view:nth-child(5) {
	margin-left: 30rpx;
	text-align: center;
	color: #fff;
	background-color: rgb(64, 158, 255);
	border-radius: 30rpx;
}
.user_info>view{
	width: 120rpx;
	color: #919191;
	font-size: 28rpx;
	padding: 20rpx 0;
}
.user_popup {
	padding: 30rpx 30rpx;
	display: flex;
	flex-direction: column;
	height: 600rpx;
	width: 600rpx;
	box-shadow: 0px 0px 6px #eee;
	background-color: #fff;
}
.tip_popup {
	padding: 30rpx 30rpx;
	display: flex;
	flex-direction: column;
	height: 600rpx;
	width: 600rpx;
	box-shadow: 0px 0px 6px #eee;
	background-color: #fff;
}
.popup_title .item {
	font-size: 18px;
}
.tip_time {
	margin-left: 160rpx;
	font-size: 16px;
}
.plant_popup {
	padding: 20rpx 30rpx;
	display: flex;
	flex-direction: column;
	height: 800rpx;
	width: 600rpx;
	box-shadow: 0px 0px 6px #eee;
	background-color: #fff;
}
.popup_title {
	display: flex;
	font-size: 18px;
	color: #303133;
}
.popup_info {
	flex-direction: column;
	margin-top: 20rpx;
	display: flex;
	justify-content: flex-start;	
}
.tip_popup_info {
	flex-direction: column;
	display: flex;
	justify-content: flex-start;
}
.plantCont {
	display: flex;
	flex-direction: column;
}
.time {
	color: #303133;
}
.popup_bottom {
	display: flex;
	justify-content: space-between;
	margin-top: 90rpx;
}
.plantBottom {
	margin-top: 50rpx;
}
.tip_popup_bottom{
	display: flex;
	justify-content: space-between;
	margin-top: 20rpx;
}
.tip_popup_bottom button:first-child{
	background-color: #5ca3ff;
	height: 80rpx;
	width: 120rpx;
	color: #fff;
	font-size: 30rpx;
}
.tip_popup_bottom button:last-child{
	background-color: #c8c8c8;
	height: 80rpx;
	width: 120rpx;
	color: #fff;
	font-size: 30rpx;
}
.popup_bottom button:first-child{
	background-color: #5ca3ff;
	height: 80rpx;
	width: 120rpx;
	color: #fff;
	font-size: 30rpx;
}
.popup_bottom button:last-child{
	height: 80rpx;
	width: 120rpx;
	font-size: 30rpx;
}
.detail {
	display: flex;
	margin-top: 30rpx;
}
.detail input {
	margin-left: 30rpx;
	flex: 1;
	padding-left: 20rpx;
	color: #367be2;
	border: 1px solid #919191;
}
.user_info view:nth-child(1){
	width: 120rpx;
	overflow: hidden;
	text-overflow: ellipsis;
}

.user_info view:nth-child(2){
	width: 235rpx;
	overflow: hidden;
	text-overflow: ellipsis;
}
	
.user_info view:nth-child(3){
	
}
.user_info view:nth-child(4){
	text-align: center;
	color: #fff;
	background-color: rgb(64, 158, 255);
	border-radius: 30rpx;
}
.plant_info_title {
	display: flex;
	justify-content: space-between;
}
.plant_info_title>view {
	color: #414141;
	font-size: 32rpx;
	padding: 20rpx 0;
}
.plant_info {
	display: flex;
	justify-content: space-between;
	flex-wrap: nowrap;
	border: 1px solid #919191;
}
.grow_info {
	display: flex;
	justify-content: space-between;
	flex-wrap: nowrap;
	border: 1px solid #919191;
}
.grow_info>view{
	color: #919191;
	font-size: 28rpx;
	line-height: 80rpx;
	width: 100rpx;
	height: 80rpx;
	display: -webkit-box;
	word-break: break-all;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	overflow: hidden;
	text-overflow: ellipsis;
}
.grow_info>view:nth-child(4){
	margin-left: 40rpx;
}
.grow_info>view:nth-child(5){
	margin-right: 0rpx;
	text-align: center;
	color: #fff;
	width: 120rpx;
	background-color: rgb(64, 158, 255);
	border-radius: 30rpx;
}
.plant_info>view {
	color: #919191;
	font-size: 28rpx;
	line-height: 80rpx;
	width: 140rpx;
	height: 80rpx;
	display: -webkit-box;
	word-break: break-all;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	overflow: hidden;
	text-overflow: ellipsis;
}
.plant_info>view:nth-child(3){
	margin-left: 40rpx;
}
.plant_info>view:nth-child(4){
	margin-right: 0rpx;
	text-align: center;
	color: #fff;
	width: 120rpx;
	background-color: rgb(64, 158, 255);
	border-radius: 30rpx;
}
.msg {
	margin-top: 50rpx;
}
.lunch_time {
	font-size: 32rpx;
	margin-left: 60rpx;
	color: #919191;
}
.msgBottom {
	display: flex;
	justify-content: space-between;
}
.lunchBottom {
	margin-top: 20rpx;
}
.isVi {
	display: flex;
	margin-left: 60rpx;
}
</style>
